home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / docs / misc / ConcNews.lha / news / general.programming / alt.lang.cfutures_8_000021.msg next >
Encoding:
Text File  |  1994-11-27  |  1.5 KB  |  42 lines

  1. Newsgroups: alt.lang.cfutures,comp.lang.c
  2. Path: dd.chalmers.se!news.chalmers.se!sunic!EU.net!uknet!liv!news!bruce
  3. From: bruce@liverpool.ac.uk (Bruce Stephens)
  4. Subject: Re: auto int array[n]
  5. In-Reply-To: lou@xilinx.com's message of Tue, 1 Mar 1994 17:17:39 GMT
  6. Message-ID: <BRUCE.94Mar3105536@cmsr3.liverpool.ac.uk>
  7. Sender: news@liverpool.ac.uk (News System)
  8. Nntp-Posting-Host: cmsr3.scm.liv.ac.uk
  9. Organization: Centre for Mathematical Software Research, Univ. Liverpool
  10. References: <ADK.94Feb25182210@ds4.scri.fsu.edu> <1994Mar1.171739.19872@xilinx.com>
  11. Date: Thu, 3 Mar 1994 10:55:36 GMT
  12. Lines: 27
  13. Xref: dd.chalmers.se alt.lang.cfutures:8 comp.lang.c:10642
  14.  
  15. >>>>> On Tue, 1 Mar 1994 17:17:39 GMT, lou@xilinx.com (Lou Sanchez-Chopitea) said:
  16.  
  17. >     Probably because it's not needed.
  18.  
  19. >     void foo (int n)
  20. >     {
  21. >         int *pi;
  22.  
  23. >         pi = calloc( n, sizeof( *pi));
  24. >         ...;
  25. >         free( pi);
  26. >     }
  27.  
  28. That's all very well, but I still find "int pi[n]" more readable.
  29. More generally, it would be of great benefit to be able to write
  30. "double a[n][m]", where n and m are only known at runtime.
  31.  
  32. Notice that C doesn't even have Fortran's facility with 2-d arrays:
  33. you can't write
  34.  
  35. void foo(int n, double a[][n]);
  36.  
  37. Fortunately, the ANSI C committee is working on it, and at least one
  38. compiler (GCC) supports this already (together with int pi[n]).
  39. --
  40. Bruce                    Institute of Advanced Scientific Computation
  41. bruce@liverpool.ac.uk    University of Liverpool
  42.